﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using DataDeal;
using Model;
using System.Collections.Generic;

namespace OMSWeb.Controls
{
    public partial class leftMenu : System.Web.UI.UserControl
    {
        public string returnStr = "";
        private GoodsItemsDAL _dal;
        public IList<GoodsItems> GoodsItemsList;
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                _dal = new GoodsItemsDAL();
                GoodsItemsList = _dal.GetAllGoodsItems();
                // returnStr = @"[{ id: 1, pid: 0, text: '1' },{ id: 2, pid: 1, text: '1.1' }, { id: 4, pid: 2, text: '1.1.2' }]";
                returnStr = "[";
                foreach (GoodsItems item in GoodsItemsList)
                {
                    returnStr += "{ id: '" + item.Id + "', pid: '" + item.ParentId + "', text: '" + item.Name + "' },";
                }
                returnStr = returnStr.Substring(0, returnStr.Length - 1) + "]";
            }



        }
    }
}